package com.medvalley.tcm.controller;

import com.medvalley.tcm.base.Result;
import com.medvalley.tcm.pojo.EarPojo;
import com.medvalley.tcm.service.IDiagnosisDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@Api(value = "耳朵相关接口")
public class EarController extends BaseController {

    @Autowired
    private IDiagnosisDataService diagnosisDataService;

    @ApiOperation(value = "上传耳朵数据")
    @RequestMapping(value = "/ear/save", method = RequestMethod.POST)
    public Result saveEarData(@ModelAttribute EarPojo earData) {
        diagnosisDataService.saveEarData(earData);
        return success("",earData);
    }

    @ApiOperation(value = "根据id获取单个耳朵检测数据")
    @RequestMapping(value = "/ear/findById", method = RequestMethod.POST)
    public Result getEarData(@RequestParam long id) {
        EarPojo earPojo = diagnosisDataService.getEarDataById(id);
        return success("", earPojo);
    }

    @ApiOperation(value = "更新耳朵检测数据")
    @RequestMapping(value = "/ear/update", method = RequestMethod.POST)
    public Result updateEarData(@ModelAttribute EarPojo pojo) {
        diagnosisDataService.updateEarData(pojo);
        return success();
    }

}
